// @ts-ignore
import {defineConfig} from 'vite'
// @ts-ignore
import vue from '@vitejs/plugin-vue'
// @ts-ignore
import {resolve} from 'path'
// @ts-ignore
import styleImport, {VantResolve} from 'vite-plugin-style-import';


const pathResolve = (dir: string): any => {
    // @ts-ignore
    return resolve(__dirname, ".", dir)
}

const alias: Record<string, string> = {
    '@': pathResolve("src")
}

export default defineConfig({
    plugins: [
        vue(),
        styleImport({
            resolves: [VantResolve()],
            libs: [
                {
                    libraryName: 'vant',
                    esModule: true,
                    resolveStyle: (name) => `../es/${name}/style`,
                }]
        }),
    ],
    resolve: {
        alias
    }
});

